/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.z100h.supplychain.warehouse.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.z100h.supplychain.warehouse.entity.Warehouse;
import com.z100h.supplychain.warehouse.mapper.WarehouseMapper;

/**
 * 仓库管理Service
 * @author madara
 * @version 2018-09-20
 */
@Service
@Transactional(readOnly = true)
public class WarehouseService extends CrudService<WarehouseMapper, Warehouse> {

	@Autowired
	private WarehouseMapper warehouseMapper;

	@Override
	public Warehouse get(String id) {
		return super.get(id);
	}

	@Override
	public List<Warehouse> findList(Warehouse warehouse) {
		return super.findList(warehouse);
	}

	@Override
	public Page<Warehouse> findPage(Page<Warehouse> page, Warehouse warehouse) {
		return super.findPage(page, warehouse);
	}

	@Override
	@Transactional(readOnly = false)
	public void save(Warehouse warehouse) {
		super.save(warehouse);
	}

	@Override
	@Transactional(readOnly = false)
	public void delete(Warehouse warehouse) {
		super.delete(warehouse);
	}

	/**
	 * 
	 * 根据仓库类型查询仓库
	 * 
	 * @param type
	 * @return
	 * @author: Fyh - 1009173473@qq.com 
	 * @date: Created on 2019年1月7日 下午4:31:53
	 */
	public List<Warehouse> findWarehouseByType(Warehouse warehouse) {
		return warehouseMapper.findWarehouseByType(warehouse);
	}

	public String getWarehouseByCompanyId(String companyId) {
		return warehouseMapper.getWarehouseByCompanyId(companyId);
	}

	/**
	 * 更具仓库类型查唯一个仓库
	 * 
	 * @param type
	 * @param companyId
	 * @return
	 * @author: Elvin Zhao - 279152260@qq.com 
	 * @date: Created on 2020年7月7日 上午11:26:09
	 */
	public String getWarehouseByType(String type, String companyId) {
		return warehouseMapper.getWarehouseByType(type, companyId);
	}

}